#include<iostream>
#include<vector>
using namespace std;
int  n,m;
vector<int> v1;
void dfs(int pos, int begin)
{
	if(pos > m)
	{
		for(auto x : v1)
		{
			cout << x << " ";
		}
		cout << endl;
		return;
	}
	for(int i = begin; i <= n; i++)
	{
		v1.push_back(i);
		dfs(pos + 1,i + 1);
		v1.pop_back();
	}
}
int main()
{
	cin >> n >> m;
	dfs(1,1);
	return 0;
}
